package com.supermap.originTest;


import com.supermap.data.*;


public class TestReadShape {

	public static void main(String[] args) {

		

		Workspace workspace = new Workspace();
		WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo(
				"E:\\MapData\\2023\\202312\\WorkSpace.smwu");
		conInfo.setType(WorkspaceType.SMWU);
		workspace.open(conInfo);

		DatasourceConnectionInfo connectionInfo = new DatasourceConnectionInfo();
		connectionInfo.setEngineType(EngineType.VECTORFILE);
		connectionInfo.setServer("E:\\MapData\\2023\\202312\\area2020.shp");
//        connectionInfo.setServer(getPrefixPath() + xycsShpPath);
		connectionInfo.setAlias("xycsShp");
		connectionInfo.setPassword("");

		Datasource ds = workspace.getDatasources().open(connectionInfo);
		Datasets datasets = ds.getDatasets();
		System.out.println(datasets.get(0));
		connectionInfo.dispose();
		workspace.save();
		workspace.dispose();




		




//
//		datasetVector.getAllFeatures().forEach((k,v)->{
//			System.out.println(k);
//			Geometry subGeo = v.getGeometry();//datasetVector.query(queryParameter).getGeometry();
//
//			Geometry intersect = Geometrist.intersect(geometry, subGeo);
//			MultilayerOverlayResult[] overlayResults = OverlayAnalyst.intersect(Arrays.asList(new Geometry[]{geometry}, new Geometry[]{subGeo}), 1.0E-10);
//			//System.out.println(overlayResults[0].getGeometry().toXML().equals(intersect.toXML()));
//			if(overlayResults==null){
//				System.out.println("overlayResults: null");
//			}else {
//				System.out.println("overlayResults: "+Toolkit.GeometryToGeoJson(overlayResults[0].getGeometry()));
//			}
//			if(intersect==null){
//				System.out.println("intersect: null");
//				//System.out.println(Toolkit.GeometryToGeoJson(geo2));
//			}else {
//				GeoRegion geoRegion= (GeoRegion) intersect;
//
//				Record r;
//				System.out.println("area: "+geoRegion.getArea());
//				System.out.println("intersect: "+Toolkit.GeometryToGeoJson(intersect));
//			}
//
//		});
//

	}


}  

